export const getBrowserInfo = () => {
    let explorer = window.navigator.userAgent;
    explorer = explorer.toLowerCase();
    //ie
    if (explorer.indexOf('msie') >= 0) {
        let ver = explorer.match(/msie ([\d.]+)/)[1] || '';
        return {name: 'IE', version: ver};
    }
    //firefox
    else if (explorer.indexOf('firefox') >= 0) {
        let ver = explorer.match(/firefox\/([\d.]+)/)[1] || '';
        return {name: 'Firefox', version: ver};
    }
    //Chrome
    else if (explorer.indexOf('chrome') >= 0) {
        let ver = explorer.match(/chrome\/([\d.]+)/)[1] || '';
        return {name: 'Chrome', version: ver};
    }
    //Opera
    else if (explorer.indexOf('opera') >= 0) {
        let ver = explorer.match(/opera.([\d.]+)/)[1] || '';
        return {name: 'Opera', version: ver};
    }
    //Safari
    else if (explorer.indexOf('safari') >= 0) {
        let ver = explorer.match(/version\/([\d.]+)/)[1] || '';
        return {name: 'Safari', version: ver};
    }
    if (explorer.indexOf('edge') >= 0) {
        let ver = explorer.match(/edge\/([\d.]+)/)[1] || '';
        return {name: 'edge', version: ver};
    }
    //遨游浏览器
    if (explorer.indexOf('maxthon') >= 0) {
        let ver = explorer.match(/maxthon\/([\d.]+)/)[1] || '';
        return {name: '傲游浏览器', version: ver};
    }
    //QQ浏览器
    if (explorer.indexOf('qqbrowser') >= 0) {
        let ver = explorer.match(/qqbrowser\/([\d.]+)/)[1] || '';
        return {name: 'QQ浏览器', version: ver};
    }
    //搜狗浏览器
    if (explorer.indexOf('se 2.x') >= 0) {
        return {name: '搜狗浏览器', version: ''};
    }
    return {name: '', version: ''};
}